import router from '@system.router';
export default {
    data: {
        title: 'World',
        //      时间参数
        account_name:"-",
        last_update:String,
        nowtime:String,
        year:Number,
        month:Number,
        date:Number,
        hour:Number,
        minute:Number,
        secondss:Number
    },

    onInit(){
        this.get_time();
    },

    //获取当前时间方法
    get_time(){
        //定义Date类的对象now
        var now = new Date();
        //        获取当前年
        this.year = now.getFullYear()
        //        获取当前月，需要加1，与实际月份相差1
        this.month = now.getMonth()+1
        //        获取当前日期
        this.date = now.getDate()
        //        获取当前小时
        this.hour = now.getHours()
        //        获取当前分钟
        this.minute = now.getMinutes()
        //        获取当前秒
        this.secondss = now.getSeconds()
        //        数字位数小于2时加上0
        if(now.getMonth()+1<10){
            this.month = "0"+ (now.getMonth()+1)
        }
        if(now.getDate()<10){
            this.date = "0"+ now.getDate()
        }
        if(now.getHours()<10){
            this.hour = "0"+ now.getHours()
        }
        if(now.getMinutes()<10){
            this.minute = "0"+ now.getMinutes()
        }
        if(now.getSeconds()<10){
            this.secondss = "0"+ now.getSeconds()
        }
        //        制定时间戳
        this.nowtime = this.year.toString() + this.month.toString() + this.date.toString() + this.hour.toString()+ this.minute.toString()+this.secondss.toString()
        //        格式化当前时间
        this.last_update = this.year + "-" + this.month + "-" + this.date + " " + this.hour + ":" +this.minute + ":" + this.secondss
        //        打印时间戳和格式化时间
        console.info(this.nowtime)
        console.info(this.last_update)
        console.info("年："+this.year+"月："+this.month+"日："+this.date+"时："+this.hour+"分:"+this.minute+"秒:"+this.secondss)
    },

    launch() {
        router.push ({
            uri: 'pages/action_video_3/action_video_3',
        });
    },
    launch4() {
        router.push ({
            uri: 'pages/niam/niam',
        });
    },
    launch5() {
        router.push ({
            uri: 'pages/action2/action2',
        });
    },
    launch6() {
        router.push ({
            uri: 'pages/pinggu/pinggu',
        });
    },
}
